#include "Mesh.h" 
using namespace std;
int main()
{
  Mesh<2>* mesh = new EasyMesh("D");
  int numgrid = mesh->getNumGrid();
  cout << "number of grids is:" << numgrid << endl;
  int numdofs = mesh->getTotalNumDofs();
  cout << "number of dofs is:" << numdofs << endl;
  Grid<2> g0 = mesh->getGrid(0);
  Grid<2> g1 = mesh->getGrid(1);
  vector<Point<2> > p0 = g0.getVertices();
  cout << "第0个网格的顶点坐标为:\n";
  for (auto& p : p0) {
    cout << p;
  }  
  cout << endl;
  vector<Point<2> > p1 = g1.getVertices();
  cout << "第1个网格的顶点坐标为:\n";
  for (auto& p :p1 ) {
    cout << p;
  }
  cout << endl;
  vector<pair<int,int> > index_bndmark0 = mesh->getIndexofGrid(0);
  cout << "第0个网格的自由度编号、boundarymark为:\n";
  for (auto& ib : index_bndmark0) {
    cout << "index: " << ib.first << ",boundarymark: " << ib.second << "\n";
  }
  cout << endl;
  set<Dofs<2> > boundarydofs = mesh->getBoundaryDofs(); cout << "边界上的自由度为:\n"; for(auto it = boundarydofs.begin(); it != boundarydofs.end(); ++it) { cout << *it << "\n"; }
  cout << endl;

  // call getBoundaryMark by Mesh*
  EasyMesh* easy_mesh = dynamic_cast<EasyMesh *>(mesh);
  int boundarymark = easy_mesh->getBoundaryMark(1);
  cout <<"第1个自由度的boundarmark为："<< boundarymark << "\n";
  return 0;
}
